#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

const int N = 1e6 + 10, INF = 0x3f3f3f3f;

int n;
vector<int> g[N];
int d[N], ans[N], tt, mx = INF;

void dfs(int x, int fa)
{
    d[x] = 1;
    int tmp = 0;
    for (int y : g[x]) {
        if (y == fa)continue;
        dfs(y, x);
        d[x] += d[y];
        tmp = max(tmp, d[y]);
    }
    tmp = max(tmp, n - d[x]);
    if (tmp < mx) {
        mx = tmp;
        ans[tt = 1] = x;
    } else if (tmp == mx) ans[++tt] = x;
}

void solve()
{
    cin >> n;
    for (int i = 1;i < n;i++) {
        int u, v;cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dfs(1, 0);
    for (int i = 1;i <= tt;i++) cout << ans[i] << ' ';
}

signed main()
{
    // ios::sync_with_stdio(0);
    // cin.tie(0);cout.tie(0);
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    int T = 1;
    //cin>>T;
    for (int i = 1;i <= T;i++) {
        solve();
    }
}